package com.skycode6.dao;

import com.mysql.cj.protocol.x.Notice;
import com.skycode6.bean.NewsBean;
import com.skycode6.bean.NoticeBean;
import com.skycode6.util.DBConnection;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/notice.jsp")
public class NoticeDao extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        // 3
        NewsDao newsDao = new NewsDao();
        List<NewsBean> news = newsDao.getList(newsDao.countPage());
        req.setAttribute("news",news);
        // 4显示页面 网页重定向显示
        req.getRequestDispatcher("WEB-INF/news.jsp").forward(req,resp);
    }

    public List<NewsBean> getList(int page) {
        DBConnection DBConn = new DBConnection();
        return null;
    }

    public int add(NoticeBean noticeBean) {
        DBConnection DBConn = new DBConnection();
        return 0;
    }

    public int deleteNewsByNewsID(int id) {
        return 0;
    }

    public int update(NoticeBean noticeBean) {
        return 0;
    }

    public Notice getNoticeByID(int noticeID) {
        return null;
    }

    public int countPage() {
        return 0;
    }
}
